-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
schema: Add new index for customvar_flat
#617
Conversation
This is required, because Icinga/ipl-orm#110 will change how Icinga DB Web filters custom variables. Without an index, the then not dependent subqueries will perform a full table scan. I also played around with just an index on |
Pretty much the same as for #616:
But probably do one PR first as both append something to the upgrade file, you'd probably end up with a new merge conflict otherwise. |
e3150ce
to
d4b3dec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New files names don't match PR milestone.
There are no new files. It's mixed up already and will be cleaned up with #602, including the schema version. |
@@ -987,7 +987,8 @@ CREATE TABLE customvar_flat ( | |||
|
|||
PRIMARY KEY (id), | |||
|
|||
INDEX idx_customvar_flat_customvar_id (customvar_id) | |||
INDEX idx_customvar_flat_customvar_id (customvar_id), | |||
INDEX idx_customvar_flat_flatname_flatvalue (flatname, flatvalue(255)) COMMENT 'Lists filtered by custom variable' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 255 just respects MySQL limits...
(source: @nilmerg)
@@ -1564,13 +1564,16 @@ ALTER TABLE customvar_flat ALTER COLUMN customvar_id SET STORAGE PLAIN; | |||
ALTER TABLE customvar_flat ALTER COLUMN flatname_checksum SET STORAGE PLAIN; | |||
|
|||
CREATE INDEX idx_customvar_flat_customvar_id ON customvar_flat(customvar_id); | |||
CREATE INDEX idx_customvar_flat_flatname_flatvalue ON customvar_flat(flatname, flatvalue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... so we don't need to emulate it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. I tested with a 32k character long flatvalue
, PostgreSQL was happy.
resolves #523
postgres changes still tbd